﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MenuItemTask
{
    class Snack : MenuItem
    {
        public Snack(string name) : base(name)
        {

        }

        public double price;
        public double Price
        {
            get { return price; }
            private set
            {
                if (price < 0)
                {
                    Console.WriteLine("Ошибка! Введенное значение цены неверно.");
                }
                else
                {
                    price = value;
                }
            }
        }

        public override void PrintToConsole()
        {
            Console.WriteLine("{0} - Price: {1}$", name, price);
        }

        public Snack(double price, string name) : base(name)
        {
            this.price = price;
            this.name = name;
        }
    }
}
